import Vue from "vue";

import VueRouter from "vue-router";

Vue.use(VueRouter);

const router = new VueRouter({
  mode: "hash",
  routes: [
    { path: "/", redirect: "/home" }, //

    {
      path: "/login",
      component: () => import("../views/login/Login.vue"),
      name: "Login",
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/reg",
      component: () => import("../views/reg/index.vue"),
      name: "Reg",
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/home",
      component: () => import("../views/home/Home.vue"),
      name: "Home",
      meta: {
        showTabbar: true,
        needLogin: true,
      },
      redirect: "/home/show",
      children: [
        {
          path: "show",
          component: () => import("../views/home/show/index.vue"),
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
        {
          path: "circum",
          component: () => import("../views/home/circum/index.vue"),
          name: "Circum",
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
        {
          path: "mall",
          component: () => import("../views/home/mall/index.vue"),
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
        {
          path: "city",
          component: () => import("../views/home/city/index.vue"),
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
        {
          path: "serach",
          component: () => import("../views/home/serach/index.vue"),
          meta: {
            showTabbar: true,
          },
        },
      ],
    },
    {
      path: "/detail",
      component: () => import("../views/detail/detail.vue"),
      name: "Detail",
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/shopcar",
      component: () => import("../views/shopcar/shopcar.vue"),
      name: "ShopCar",
      meta: {
        showTabbar: false,
      },
    },
    {
      path: "/find",
      component: () => import("../views/find/Find.vue"),
      name: "Find",
      meta: {
        showTabbar: true,
      },
      redirect: "/find/show",
      children: [
        {
          path: "show",
          component: () => import("../views/find/show/index.vue"),
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
        {
          path: "video",
          component: () => import("../views/find/video/index.vue"),
          meta: {
            showTabbar: true,
            needLogin: true,
          },
        },
      ],
    },
    {
      path: "/message",
      component: () => import("../views/message/Message.vue"),
      name: "Message",
      meta: {
        showTabbar: true,
      },
     /* 配置二级路由 */
     children:[
      {
        path: 'attention',
        component: () => import('../views/message/attention/Attention.vue')
      },
      {
        path: 'official',
        component: () => import('../views/message/official/Official.vue')
      },
      {
        path: 'chat',
        component: () => import('../views/message/chat/Chat.vue')
      },
      {
        path: 'comment',
        component: () => import('../views/message/comment/Comment.vue')
      },
    ],
    },
    {
      path: "/mine",
      component: () => import("../views/mine/Mine.vue"),
      name: "Mine",
      meta: {
        showTabbar: true,
        needLogin: true,
      },
    },
  ],
  linkActiveClass: "active",
});

export default router;
